import axios from 'axios'
axios.defaults.withCredentials = true

//导出request
export function request(config) {
    //创建实例
    const instance = axios.create({
        baseURL: 'http://localhost:3000',
        timeout: 5000
    });
    //拦截器
    //请求拦截
    instance.interceptors.request.use(config => {
        return config
    }, err => {
        console.log(err)
    });
    //响应拦截
    instance.interceptors.response.use(config => {
        return config
    }, err => {
        console.log(err)
    });
    return instance(config)
}